if(!document.all){
	//节点操作兼容
	with(window.Node.prototype){		
		__defineGetter__("parentElement",function(){
	        
	        return this.parentNode;});
	};
	
	//HTML元素兼容
	with(window.HTMLElement.prototype){
	    __defineGetter__("parentElement",function(){
	        return (this.parentNode==this.ownerDocument)?null:this.parentNode;});

	    __defineGetter__("children",function(){
	        var c=[];
	        for(var i=0,cs=this.childNodes;i<cs.length;i++){
	            if(cs[i].nodeType==1)
	                c.push(cs[i]);}
	        return c;});
	    /**
	    __defineGetter__("canHaveChildren",function(){
	        return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/i.test(this.tagName);});

	    __defineSetter__("outerHTML",function(s){
	        var r=this.ownerDocument.createRange();
	        r.setStartBefore(this);
	        void this.parentNode.replaceChild(r.createContextualFragment(s),this);
	        return s;});
	    __defineGetter__("outerHTML",function(){
	        var as=this.attributes;
	        var str="<"+this.tagName;
	        for(var i=0,al=as.length;i<al;i++){
	            if(as[i].specified)
	                str+=" "+as[i].name+"=""+as[i].value+""";}
	        return this.canHaveChildren?str+">":str+">"+this.innerHTML+"</"+this.tagName+">";});

	    __defineSetter__("innerText",function(s){
	        return this.innerHTML=document.createTextNode(s);});
	    __defineGetter__("innerText",function(){
	        var r=this.ownerDocument.createRange();
	        r.selectNodeContents(this);
	        return r.toString();});

	    __defineSetter__("outerText",function(s){
	        void this.parentNode.replaceChild(document.createTextNode(s),this);
	        return s});
	    __defineGetter__("outerText",function(){
	        var r=this.ownerDocument.createRange();
	        r.selectNodeContents(this);
	        return r.toString();});

	    insertAdjacentElement=function(s,o){
	        return (s=="beforeBegin"&&this.parentNode.insertBefore(o,this))||(s=="afterBegin"&&this.insertBefore(o,this.firstChild))||(s=="beforeEnd"&&this.appendChild(o))||(s=="afterEnd"&&((this.nextSibling)&&this.parentNode.insertBefore(o,this.nextSibling)||this.parentNode.appendChild(o)))||null;}

	    insertAdjacentHTML=function(s,h){
	        var r=this.ownerDocument.createRange();
	        r.setStartBefore(this);
	        this.insertAdjacentElement(s,r.createContextualFragment(h));}

	    insertAdjacentText=function(s,t){
	        this.insertAdjacentElement(s,document.createTextNode(t));}
	    */
	};
	Element.prototype.selectSingleNode = function(sXPath){
		var oEvaluator = new XPathEvaluator();
		var oResult = oEvaluator.evaluate(sXPath,this,null,
											XPathResult.FIRST_ORDERED_NODE_TYPE,null);
		if(oResult != null){
			return oResult.singleNodeValue;
		}else{
			return null;
		}
	};
	
	Element.prototype.selectNodes = function(sXPath){
		var oEvaluator = new XPathEvaluator();
		var oResult = oEvaluator.evaluate(sXPath,this,null,
											XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);
		var aNodes = new Array();
		if(oResult != null){
			var oElement = oResult.iterateNext();
			while(oElement){
				aNodes.push(oElement);
				oElement = oResult.iterateNext();
			}
		}
		return aNodes;
	};
	
	Element.prototype.transformNode = function(oXslDoc){
		try {
			var xsltProcessor = new XSLTProcessor();
			xsltProcessor.importStylesheet(oXslDoc);
			var result = xsltProcessor.transformToDocument(this);
			
			var xmls = new XMLSerializer();
			return xmls.serializeToString(result);
	  	}catch(e) {
	  		return this.transformNode(oXslDoc);
	  	}
	  	return null;
	};
	
	Element.prototype.__defineGetter__("xml",function(){
		try {
			var serializer = new XMLSerializer();
	    	return serializer.serializeToString(this,"text/xml");
	    	//delete serializer
	    	
	  	}catch(e) {
	  		return this.xml;
	  	}
	  	return null;	
	});
	
	Element.prototype.__defineGetter__("text",function(){
		var sText = "";
		for (var i = 0; i < this.childNodes.length; i++) {
			if (this.childNodes[i].hasChildNodes()) {
		    	sText += getText(this.childNodes[i]);
			} else {
		    	sText += this.childNodes[i].nodeValue;
			}
		}
		return sText;
	});
	Element.prototype.__defineSetter__("text",function(s){
		this.textContent = s;
	});

};
/**
 * 
 * @param URL 
 * @param dataXml = <send></send>
 * @param async true,false;
 * @param recall load  = > load(args,retDoc)
 * @param args arr[2];
 * @return
 */

function commHttpSend(URL,dataXml,async,recall,args){
	var xmlhttp = null; 
	try{
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}catch(e){
		xmlhttp = new XMLHttpRequest();
	}

	xmlhttp.open("POST",URL, async);
	
	if(async){
		xmlhttp.onreadystatechange = function (){
			if(xmlhttp.readyState==4){
				if(xmlhttp.status == 200){
					if(recall != null){
						if(xmlhttp.responseXML != null){
							if(xmlhttp.responseXML.documentElement.nodeName == "error" && xmlhttp.responseXML.documentElement.text == "sessionTimeOut"){
								window.location.href = "/transLogin.jsp";
								return null;
							}
						}
						eval(recall+"(args,xmlhttp.responseXML)");
					}
					delete xmlhttp;  //收到返回结果后手动删除  
					xmlhttp = null;  
				}
				

			}
			
		};
	}
	
	//xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	
	if(dataXml == null){
		xmlhttp.send(null);
	}else{
		xmlhttp.send(dataXml);
	}
	if(!async){
		if(xmlhttp.responseXML != null){
			if(xmlhttp.responseXML.documentElement.nodeName == "error" && xmlhttp.responseXML.documentElement.text == "sessionTimeOut"){
				window.location.href = "/transLogin.jsp"
			}
		}
		return xmlhttp.responseXML;
	}
	
	return null;
	
}

function commLoad(URL){
	
	var retDom = null;
	try{
		retDom = new ActiveXObject('Microsoft.XMLDOM');
		retDom.async = false;
		retDom.load(URL);
	}catch(e){
		try{
			retDom = document.implementation.createDocument("", "", null);    
			retDom.async = false;
			retDom.load(URL);
		}catch(e1){
			 var xmlhttp = new window.XMLHttpRequest();   
			 xmlhttp.open("GET",URL,false);
			 xmlhttp.send(null);   
			 retDom = xmlhttp.responseXML;
		}
	}
	return retDom;	

}

function commLoadXML(xml){
	var retDom = null;
	try{
		retDom = new ActiveXObject('Microsoft.XMLDOM');
		retDom.async = false;
		retDom.loadXML(xml);
	}catch(e){
		var oParser = new DOMParser();
		retDom = oParser.parseFromString(xml,"text/xml");
	}
	
	return retDom;
}

function xml2New(xmlDom,xslDom){
	var newDom = null;
	try{
		newDom = new ActiveXObject("Microsoft.XMLDOM");
		newDom.async = false;
		newDom.validateOnParse = false;
		xmlDom.transformNodeToObject(xslDom,newDom);
	}catch(e){
		var xsltProcessor = new XSLTProcessor();
		xsltProcessor.importStylesheet(xslDom);
		newDom = xsltProcessor.transformToDocument(xmlDom);
	}
	return newDom;
}

//yyyy-MM-dd
String.prototype.isDate = function(){ 
 	//最强的日期检测正则，像某月存不存在某日也可以检测出来 
	var result = this.match(/^(?:(?:1[6-9]|[2-9]\d)?\d{2}[\/\-\.](?:0?[1,3-9]|1[0-2])[\/\-\.](?:29|30))(?: (?:0?\d|1\d|2[0-3])\:(?:0?\d|[1-5]\d)\:(?:0?\d|[1-5]\d)(?: \d{1,3})?)?$|^(?:(?:1[6-9]|[2-9]\d)?\d{2}[\/\-\.](?:0?[1,3,5,7,8]|1[02])[\/\-\.]31)(?: (?:0?\d|1\d|2[0-3])\:(?:0?\d|[1-5]\d)\:(?:0?\d|[1-5]\d)(?: \d{1,3})?)?$|^(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])[\/\-\.]0?2[\/\-\.]29)(?: (?:0?\d|1\d|2[0-3])\:(?:0?\d|[1-5]\d)\:(?:0?\d|[1-5]\d)(?: \d{1,3})?)?$|^(?:(?:16|[2468][048]|[3579][26])00[\/\-\.]0?2[\/\-\.]29)(?: (?:0?\d|1\d|2[0-3])\:(?:0?\d|[1-5]\d)\:(?:0?\d|[1-5]\d)(?: \d{1,3})?)?$|^(?:(?:1[6-9]|[2-9]\d)?\d{2}[\/\-\.](?:0?[1-9]|1[0-2])[\/\-\.](?:0?[1-9]|1\d|2[0-8]))(?: (?:0?\d|1\d|2[0-3])\:(?:0?\d|[1-5]\d)\:(?:0?\d|[1-5]\d)(?: \d{1,3})?)?$/); 
	if(result == null) 
		return false;
	else
		return true; 
}
//yyyy-MM-dd hh:mm:ss
String.prototype.isDateTime = function(){
	var regexp = /(^([12][0-9])(((([13579][26])|([02468][048]))(-)(([0]{0,1}(2-)))(([0][1-9])|([2][0-9])))|((([13579][01234789])|([02468][1235679]))(-)(([0]{0,1})(2-))(([0][1-9])|([2][0-8])))|((([0-9]{2}[-])(([0]{0,1}[13578])|10|12)(-)(([0]{0,1}[1-9])|([1-2][0-9])|([3][01])))|((([0-9]{2}[-])(([0]{0,1}[469])|11)(-)(((0*)[1-9])|([12][0-9])|30)))))$)|(^(([01][0-9])|([2][0-3]))(:)([0-5]{0,1}[0-9])(((:)([0-5]{0,1}[0-9])){0,1})$)|(^([12][0-9])(((([13579][26])|([02468][048]))(-)(([0]{0,1}(2-)))(([0][1-9])|([2][0-9])))|((([13579][01234789])|([02468][1235679]))(-)(([0]{0,1})(2-))(([0][1-9])|([2][0-8])))|((([0-9]{2}[-])(([0]{0,1}[13578])|10|12)(-)(([0]{0,1}[1-9])|([1-2][0-9])|([3][01])))|((([0-9]{2}[-])(([0]{0,1}[469])|11)(-)(((0*)[1-9])|([12][0-9])|30))))))( )((([01][0-9])|([2][0-3]))(:)([0-5]{0,1}[0-9])(((:)([0-5]{0,1}[0-9])){0,1})$)/g;
	return (regexp.test(this));
}


// remove the left space;
String.prototype.ltrim = function (){ 
	return this.replace( /^\s*/, ""); 
} 
// remove the right space;
String.prototype.rtrim = function (){ 
	return this.replace( /\s*$/, ""); 
}
// remove the left and right space;
String.prototype.lrtrim = function(){
    // return this.replace(/(^\s*)|(\s*$)/g, "");
    return this.replace(/^\s+|\s+$/g, "");
}

// 简单中文字符串长度计算
String.prototype.getBytes = function() {
    var cArr = this.match(/[^\x00-\xff]/ig);
    return this.length + (cArr == null ? 0 : cArr.length);
}

function isNum(num){
	var   r   =   /^[1-9]*[1-9][0-9]*$/;//正整数     
	return r.test(num);
}

function isNonnegativeNumber(num){
	var   r   =   /^[0-9]*[0-9][0-9]*$/;//正整数     
	return r.test(num);
}

function openWindow(url,name,iWidth,iHeight,isScroll/**=yes;no;auto*/){
	var url; //转向网页的地址;
	var name; //网页名称，可为空;
	var iWidth; //弹出窗口的宽度;
	var iHeight; //弹出窗口的高度;
	var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;
	var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
	
	if(isScroll == null){
		window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
		return;
	}
	window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars='+isScroll+',resizeable=no,location=no,status=no');
	
	
}

function seesionTimeOut(){
	window.location.href = ctx + "/transLogin.jsp";
}